#include<iostream>
#include<cstring>
using namespace std;
const int N = 1e5 + 10;
int a[N];
int b[N];
int ans[N];
int main()
{
	int t = 0;
	cin >> t;
	while (t--) {
		string a1, b1;
		cin >> a1 >> b1;
		memset(a, 0, sizeof(a));
		memset(b, 0, sizeof(b));
		memset(ans, 0, sizeof(ans));
		int n = a1.size();
		int m = b1.size();
		int len = n + m;
		for (int i = 0; i < a1.size(); i++) {
			a[i] = a1[n - i - 1] - '0';
		}
		for (int i = 0; i < b1.size(); i++) {
			b[i] = b1[m - i - 1] - '0';
		}
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				ans[i + j] += a[i] * b[j];
			}
		}
		for (int i = 0; i < len; i++) {
			ans[i + 1] += ans[i] / 10;
			ans[i] %= 10;
		}
		while (len >= 1 && ans[len] == 0) {
			len--;
		}
		for (int i = len; i >= 0; i--) {
			cout << ans[i];
		}
		cout << endl;
		/*for (int i = len - 1; i > 0; i--) {
			ans[i - 1] += ans[i] / 10;
			ans[i] %= 10;
		}
		for (int i = 0; i < len - 1; i++) {
			cout << ans[i];
		}*/
	}
}
